<?php
# http://projects:8081/cdapp-2kt-api/api/capacity_record_update_item.php
include_once '_portal.php';

if (!$post) {
  die;
}

$num = $post->num;
$idx = $post->idx;
$data = json_stringify($post->data);

$sql = "UPDATE `2kt_capacity_record` SET content = JSON_SET(content,'$[{$idx}]',JSON_EXTRACT('{$data}','$')) WHERE number = {$num}";

logfile('capacity_record_update_item', $sql);

$result = false;
$result = exec_sql($sql);

output(['post' => $post, 'result' => $result, 'sql' => $sql]);

// var_export($post);